package com.skycong.hello77.activity.common;

import android.content.Context;
import android.content.res.Resources;
import android.graphics.drawable.Drawable;

/**
 * 提供当前的app的资源
 * Created by Kiki on 2018/5/11.
 */

public class ResourcesManager {
    private static final float DENSITY = Resources.getSystem().getDisplayMetrics().density;
    private static Context sAppContext;
    private static Resources sRes = null;
    private static String sPackageName = null;
    private static String mDeviceId;

    public static void init(Context context) {
        sAppContext = context;
        sRes = context.getResources();
        sPackageName = context.getPackageName();
    }

    public static Drawable getNoBoundsDrawable(int icon) {
        Drawable drawable = ResourcesManager.getDrawable(icon);
        if (drawable != null) {
            drawable.setBounds(0, 0, drawable.getMinimumWidth(),
                    drawable.getMinimumHeight());
        }
        return drawable;
    }
    public static Drawable getDrawable(final int id) {
        return sRes.getDrawable(id);
    }

}
